/*********************************************************************
*
* JLink setup file - Generated by J-Flash ARM V2.16b
*
* Syntax:
*   SetJTAGSpeed(x);           // Sets the JTAG speed, x = speed in kHz (0 = Auto)
*   Delay(x);                  // Waits a given time,  x = delay in milliseconds
*   DisableMMU();              // Disables the MMU
*   Go();                      // Starts the ARM core
*   Halt();                    // Halts the ARM core
*   Reset(x);                  // Resets the target,   x = delay in milliseconds
*   ResetBP0(x);               // Resets the target using breakpoint at address 0
*   ResetADI(x);               // Resets the target using ADI software reset
*   Read8(Addr);               // Reads a 8/16/32 bit value,
*   Read16(Addr);              //   Addr = address to read (as hex value)
*   Read32(Addr);
*   Verify8(Addr, Data);       // Verifies a 8/16/32 bit value,
*   Verify16(Addr, Data);      //   Addr = address to verify (as hex value)
*   Verify32(Addr, Data);      //   Data = data to verify (as hex value)
*   Write8(Addr, Data);        // Writes a 8/16/32 bit value,
*   Write16(Addr, Data);       //   Addr = address to write (as hex value)
*   Write32(Addr, Data);       //   Data = data to write (as hex value)
*   WriteVerify8(Addr, Data);  // Writes and verifies a 8/16/32 bit value,
*   WriteVerify16(Addr, Data); //   Addr = address to write (as hex value)
*   WriteVerify32(Addr, Data); //   Data = data to write (as hex value)
*   WriteRegister(Reg, Data);  // Writes a register
*   WriteJTAG_IR(Cmd);         // Writes the JTAG instruction register
*   WriteJTAG_DR(nBits, Data); // Writes the JTAG data register
*
**********************************************************************
*/

SetJTAGSpeed(30);
Reset(20);
Write32(0xFFFFFD44, 0x00008000);        // Disable watchdog
Write32(0xFFFFFF60, 0x00320300);        // Set flash wait states
Write32(0xFFFFFC20, 0x00000601);        // Set PLL
Delay(200);
Write32(0xFFFFFC2C, 0x00191C05);        // Set PLL and divider
Delay(200);
Write32(0xFFFFFC30, 0x00000007);        // Select master clock and processor clock
SetJTAGSpeed(4000);
